<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Jiameng extends MY_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */

	public function __construct() {
		parent::__construct();
		 $this->load->model('Category_model', 'c');
		 $this->load->model('Article_model', 'article');
		 $this->load->model('Tag_model','tag');
		 $this->load->model('Tagrelation_model','tr');
		 $this->load->model('Advertisement_model', 'ad');
		// 产品分类
		/*	$data = $this->c->getCateData('production',array());
			$this->_d['pcate'] = cate2list(0, $data);
		 $this->_d['alias'] = 'article';
		 $this->load->model('Advertisement_model', 'ad');
		$this->_d['link'] = $this->ad->getChannelAds('link');
		// 案例分类
		$this->load->model('Article_model', 'article');
		$casecate = $this->c->O(array('alias'=>'case'),'cateid');
		$this->_d['case'] = $this->article->L(array('cateid'=>$casecate['cateid']));*/

	}

	public function index($articleid='')
	{
		$sdata['status'] = 1;
		$this->_d['flag'] = 'jiameng';
		$catedata = $this->c->O(array('alias'=>'jiameng'));
		$this->_d['catename'] = $catedata['catename'];
		$this->_d['alias'] = 'jiameng';
		$sdata['cateid'] = $catedata['cateid'];
		$sdata['status'] = 1;
		$_list = $this->article->L($sdata,'*', 0,0,'sort');
		if (!empty($_list))
		{
			foreach ($_list as $k => $v)
			{
				$list[$v['articleid']] = $v;
				$list[$v['articleid']]['attachment'] = $this->getAttach($v['articleid'],'article');
			}
		}
		$this->_d['list'] = $list;
		if(!empty($articleid))
			$this->_d['row'] = $list[$articleid];
		else{
			$this->_d['row'] = array_shift($list);
		}		
		$this->load->view($this->_d['cfg']['tpl'] . 'jiameng', $this->_d);
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */